package com.bdqn.mapper;

import com.bdqn.pojo.Supplier;
import com.bdqn.pojo.SysUser;
import org.mybatis.spring.SqlSessionTemplate;

import java.util.List;

public class SysUserMapperImpl implements SysUserMapper{
    // mybatis-spring包中提供的实现了SqlSession接口的类，用来操作数据库
    private SqlSessionTemplate sqlSession;

    /**
     * 查询用户列表
     *
     * @param supplier
     * @return
     */
    @Override
    public List<Supplier> list(Supplier supplier) {
        return this.getSqlSession().getMapper(SysUserMapper.class).list(supplier);
    }

    @Override
    public int addAll(SysUser sysUser) {
        return this.getSqlSession().getMapper(SysUserMapper.class).addAll(sysUser);
    }

    public void setSqlSession(SqlSessionTemplate sqlSession) {
        this.sqlSession = sqlSession;
    }

    public SqlSessionTemplate getSqlSession() {
        return sqlSession;
    }
}
